public class iButton {
  PImage atual, img, img_mo;
  int x, y, Width, Height;
  String name;
  iButton(String bimage, int pos_x, int pos_y, String n) {
    this.img = loadImage(bimage);
    this.img_mo = loadImage(bimage);
    this.Width = img.width;
    this.Height = img.height;
    this.x = pos_x;
    this.y = pos_y;
    this.name = n;
    this.atual = this.img;
  }
  iButton(String bimage, String moimage, int pos_x, int pos_y, String n) {
    this.img = loadImage(bimage);
    this.img_mo = loadImage(moimage);
    this.Width = img.width;
    this.Height = img.height;
    this.x = pos_x;
    this.y = pos_y;
    this.name = n;
    this.atual = this.img;
  }
  private boolean mouseOver() {
    if ( (mouseX>=this.x && mouseX<=this.x+this.Width)&&(mouseY>=this.y && mouseY<=this.y+this.Height)) {
      atual = img_mo;
      return true;
    }
    else {
      atual = img;
      return false;
    }
  }

  public void Draw() {
    mouseOver();
    image(this.atual, x, y);
  }


  void setImages(String ni1, String ni2) {
    this.img = loadImage(ni1);
    this.img_mo = loadImage(ni2);
  }
  void setImage(String ni1) {
    this.img = loadImage(ni1);
    this.img_mo = img;
  }
}

